<template name="qiyexinxi-card">
	<!-- 企业信息列表项（认领企业） -->
	<view class="text-card">
		<view class="card-row card-title">
			<text class="glyphicon glyphicon-play" style="margin-right: 10px;"></text>
			{{auser.username}}
		</view>	
		<view class="card-row">
			<view class="row-label w20">评分日期</view>
			<view class="row-content w50">{{auser.yuyuedate || '未预约'}}</view>
		</view>	
		<view class="card-row">
			<view class="row-label w20">地址</view>
			<view class="row-content w80">{{auser.jingyingdizhi}}</view>
		</view>
		<view class="card-row">
			<view class="row-label w20">联系人</view>
			<view class="row-content w30">{{auser.lianxiren}}</view>
			<view class="row-label w20">联系电话</view>
			<view class="row-content w30 f16">{{auser.lianxirentel}}</view>
		</view>
		<view class="card-row">
			<view class="row-label w20">法人</view>
			<view class="row-content w30">{{auser.faren}}</view>
			<view class="row-label w20">联系电话</view>
			<view class="row-content w30 f16">{{auser.farentel}}</view>
		</view>
		<view class="card-row" v-if="auser.fsd == 1">
			<view class="row-label w20">安全总监</view>
			<view class="row-content w30">{{auser.fsdName}}</view>
			<view class="row-label w20">联系电话</view>
			<view class="row-content w30 f16">{{auser.fsdTel}}</view>
		</view>
		<view class="card-row">
			<view class="row-label w20">信用代码</view>
			<view class="row-content w50">{{auser.userno}}</view>
			<view class="w30" style="text-align: right;">
				<u-button type="primary" size="mini" @click="handleViewCompany">查看企业</u-button>
			</view>
		</view>	
		<view class="card-row">
			<view class="row-label w20">许可证号</view>
			<view class="row-content w50">{{auser.xukezhenghao}}</view>
		</view>
		<view class="card-row">
			<view class="w50" style="text-align: center;">
				<u-button :type="status=='1' ? 'primary' : 'warning'" size="mini" @click="handleClick">{{buttonTextFormat}}</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				//状态（0未受理、1已受理、2已评定（可修改现场评分）、3已审核（不可修改现场评分）、4已公示、10作废）
			}
		},
		props:{
			id:'',
			auser:{},
			formId: '',
			recordFormId: '',
			status: '',
			expertEvaluateStatus: '',
			assessStartDate: null,
			assessEndDate: null,
			expertIds: '',
			assessorNumber: '',
			// scoreRating: 0,
			// visitCount: 0,
			// resultCount: 0,
			// recordCount: 0,
		},
		computed:{
			buttonTextFormat(){
				switch(this.$props.status){
					case '1':
						return '认领企业';
						break;
					case '2':
						return '撤回认领';
						break;
					default:
						return '' + this.$props.status
				}
			}
		},
		mounted() {
			
		},
		methods:{
			handleClick(){
				let url = '';
				let data = {};
				let msg = '';
				if(this.$props.status == '1'){
					url = this.$api.EvaluateAccept
					data = {
						id: this.$props.id,
						expertIds: vk.getVuex('$user.userInfo.userId'),
					}
					msg = '认领企业';
				}else{
					url = this.$api.EvaluateAccept2 + '/' + this.$props.id
					data = {}
					msg = '撤回'
				}
				this.$util.request(url, data, 'PUT', null, null, null, null, () => this.saveMembers())
					.then(res => {
						console.log('认领', this.$props.status, res);
						if (res.code === 200) {
							vk.toast(msg + "成功", "success", 1000, true, () => {
								this.$emit('myEvent',this.$props.status)  // 通过$emit触发事件，第二个参数就是传递的参数
							});
						} else {
							console.log(msg + '失败', res)
							vk.alert(res.msg, msg + '失败');
						}
					}).catch((err) => {
						console.log(msg + '异常', err)
						this.disabled = false;
						this.loading = false;
						vk.alert(JSON.stringify(err), msg + '异常');
					})
			},
			handleViewCompany(){
				uni.navigateTo({
					url: '/pages/company/info?auser=' + encodeURIComponent(JSON.stringify(this.$props.auser))
				})
			}
		}
	}
</script>

<style>
	@import url("/static/css/main.css");
	.m-tag{
		position: absolute;
		top: 30px;
		bottom: 20px;
		left: 0upx;
		right: 0upx;
		margin: auto;
		width: 180upx;
		transform: rotate(15deg);
		/* letter-spacing: 10px; */
		font-weight: 700;
	}
	.text-card{
		position: relative;
	}
	.cu-tag{
		/* justify-content: initial; */
		display: flex;
		align-items: center;
		color: blue;
	}
</style>
